using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Configuration;

namespace Colorprj.Common
{
    class Utility
    {
        public static Double getDblVal(object obj) { 
        double  retval=0;
        if (obj != DBNull.Value && obj != null && !obj.Equals(""))
        {
            retval = Convert.ToDouble(obj);
        }
        return retval;
        }


        public static decimal getDecimalVal(object obj)
        {
            decimal retval = 0;
            if (obj != DBNull.Value && obj != null && !obj.Equals(""))
            {
                retval = Convert.ToDecimal(obj);
            }
            return retval;
        }


        public static bool getBoolVal(object obj)
        {
            bool  retval = false ;
            if (obj != DBNull.Value && !obj.Equals(""))
            {
                retval = Convert.ToBoolean(obj);
            }
            return retval;
        }

        public static int getIntVal(object obj)
        {
            int retval = 0;
            if (obj != null && obj != DBNull.Value && !obj.Equals(""))
            {
                retval = Convert.ToInt16(obj);
            }
            return retval;
        }
        //public static string  getNextChallanNo(object obj)
        //{
        //    String  retval = 0;
        //    if (obj != DBNull.Value && !obj.Equals(""))
        //    {
        //        retval = Convert.ToDouble(obj);
        //    }
        //    return retval;
        //}

        public static string GetRptLocation()
        {
            //return ConfigurationSettings.AppSettings["SimpleLocation"].ToString();
            return System.Configuration.ConfigurationManager.AppSettings["rptLocation"].ToString(); 
        }
        public static string GetInvRptLocation()
        {
            //return ConfigurationSettings.AppSettings["SimpleLocation"].ToString();
            return System.Configuration.ConfigurationManager.AppSettings["rptInvLocation"].ToString();
        }
    }
}
